#include "Shape.h"
#include <gl\glut.h>


Shape::Shape(void)
{
}

Shape::Shape( int shape,int mode /*= WIRE*/ )
{
	m_shape = shape;
	m_mode = mode;
}

Shape::~Shape(void)
{
}

void Shape::render()
{
	switch(m_shape){
	case CUBE:
		if(m_mode == WIRE){
			glDisable(GL_LIGHTING);
			glutWireCube(1.0);
			//glEnable(GL_LIGHTING);
		}
		else{
			glEnable(GL_LIGHTING);
			glutSolidCube(1.0);
		}
		break;
	case SPHERE:
		if(m_mode == WIRE){
			glDisable(GL_LIGHTING);
			glutWireSphere(0.5,20,20);
			//glEnable(GL_LIGHTING);
		}
		else{
			glEnable(GL_LIGHTING);
			glutSolidSphere(0.5,20,20);
		}
		break;
	case DISK:
		if(m_mode == WIRE){
			glDisable(GL_LIGHTING);
			GLUquadric * obj = gluNewQuadric();
			gluQuadricDrawStyle(obj,GLU_LINE);
			glPushMatrix();
				glRotatef(45,1,0,0);
				gluDisk(obj,0.05,0.2,20,10);
			glPopMatrix();
			gluDeleteQuadric(obj);
		}
		else{
			glEnable(GL_LIGHTING);
			GLUquadric * obj = gluNewQuadric();
			gluQuadricDrawStyle(obj,GLU_FILL);
			glPushMatrix();
				glRotatef(45,1,0,0);
				gluDisk(obj,0.05,0.2,20,10);
			glPopMatrix();
			gluDeleteQuadric(obj);
		}
		break;
	default:
		break;
	}
}

bool Shape::operator==( Shape s )
{
	if((m_shape == s.m_shape)
		&& (m_mode == s.m_mode))
		return true;
	else
		return false;
}
